package com.jeff.android.lab.android.touchevent;

import android.content.Intent;
import android.util.Log;
import android.view.MotionEvent;
import android.view.View;
import android.widget.FrameLayout;
import android.widget.TextView;

import com.jeff.android.lab.BaseFragment;
import com.jeff.android.lab.R;
import com.jeff.android.lab.android.touchevent.view.MyFrameLayout;

import butterknife.BindView;

/**
 * @author: duff
 * @date: 2019/3/20
 * @since: 1.0.0
 *
 * https://www.cnblogs.com/wytiger/p/5235393.html
 *
 * https://www.cnblogs.com/huihuizhang/p/7633552.html
 *
 */
public class TouchEventFragment extends BaseFragment {
    @BindView(R.id.fl)
    MyFrameLayout fl;
    @BindView(R.id.tv)
    TextView tv;

    @Override
    protected int getRootLayout() {
        return R.layout.android_fragment_touch_event;
    }

    @Override
    protected void initView() {
        super.initView();



        fl.setOnTouchListener(new View.OnTouchListener() {
            @Override
            public boolean onTouch(View v, MotionEvent event) {

                Log.d(TAG, "FrameLayout onTouch ... ");

                return false;
            }
        });

        tv.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Log.d(TAG, "TextView onClick ... ");
            }
        });

        tv.setOnTouchListener(new View.OnTouchListener() {
            @Override
            public boolean onTouch(View v, MotionEvent event) {
                Log.d(TAG, "TextView onTouch ... ");

                return false;
            }
        });
    }

    @Override
    protected void initData() {
        startActivity(new Intent(mContext, TouchEventActivity.class));
    }
}
